package chaoyue.study.jdbc;

import chaoyue.study.jdbc.utils.DbUtils;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Statement;
import java.util.ResourceBundle;

/**
 * Statement 用来封装需要执行的sql语句
 * 静态SQL是指不是通过预编译的方式去执行的SQL
 */
public class Test2_Statement1 {
    public static void main(String[] args) throws Exception {
        Connection connection = DbUtils.getConnection();

        // 创建statement
        Statement statement = connection.createStatement();
        String sql = "insert into test_user values(1,'chaoyue','123456','1991-01-01')";
        // 执行insert操作
        int affectedRows = statement.executeUpdate(sql);
        System.out.println("受影响行数：" + affectedRows);
    }
}
